package com.bdqn.controller;

import com.bdqn.Service.Contract.ContractService;
import com.bdqn.Service.ContractApply.ContractApplyService;
import com.bdqn.Service.Enquire.EnquireService;
import com.bdqn.Service.Material.MaterialService;
import com.bdqn.Service.Stock.StockService;
import com.bdqn.Service.Supplier.SupplierService;
import com.bdqn.entity.Contract;
import com.bdqn.entity.Supplier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@ResponseBody
@RequestMapping("/Index")
public class IndexMainController {
    @Autowired
    ContractService contractService;
    @Autowired
    MaterialService materialService;
    @Autowired
    StockService stockService;
    @Autowired
    EnquireService enquireService;
    @Autowired
    ContractApplyService contractApplyService;
    @Autowired
    SupplierService supplierService;
    /**
     * 查询物资数
     */
    @RequestMapping("/Wz")
    public int Wz(){
        return materialService.count(null,0,0);
    }
    /**
     * 查询采购计划数
     */
    @RequestMapping("/Cg")
    public int Cg(){
        return stockService.getCount();
    }
    /**
     * 查询询价书数
     */
    @RequestMapping("/Xj")
    public int Xj(){
        return enquireService.getCount();
    }
    /**
     * 查询合同申请数
     */
    @RequestMapping("/HtSq")
    public int HtSq(){
        return contractApplyService.getCount();
    }
    /**
     * 查询合同数
     */
    @RequestMapping("/Ht")
    public int Ht(){
        return contractService.getCount(new Contract());
    }
    /**
     * 查询供应商数
     */
    @RequestMapping("/Gys")
    public int Gys(){
        return supplierService.getCount(new Supplier());
    }
}
